<template>
	<view>
		<uni-nav-bar backgroundColor='#3f6efe' color='#fff'>
			<view class="w-100p flex-c flex-aic f-28">报账图表</view>
		</uni-nav-bar>

		<view class="charts-box p-t-30 ">
			<qiun-data-charts type="bubble" :opts="opts1" :chartData="chartData1" />
		</view>

		<view class="charts-box p-t-60">
			<qiun-data-charts type="arcbar" :opts="opts2" :chartData="chartData2" />
		</view>
	</view>



</template>

<script>
	export default {
		data() {
			return {
				chartData1: {},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['bubble'] 的节点来配置全局默认参数，如都是默认参数，此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式，达到页面简洁的需求。
				opts1: {
					color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: [15, 15, 0, 15],
					legend: {},
					xAxis: {
						disableGrid: false,
						gridType: "dash",
						splitNumber: 5,
						boundaryGap: "justify",
						min: 0,
						max: 250
					},
					yAxis: {
						disableGrid: false,
						gridType: "dash",
						data: [{
							min: 0,
							max: 150
						}]
					},
					extra: {
						bubble: {
							border: 2,
							opacity: 0.5
						}
					}
				},
				chartData2: {},
				opts2: {
					color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: undefined,
					title: {
						name: "统计",
						fontSize: 35,
						color: "#1890ff"
					},
					subtitle: {
						name: "报销状态",
						fontSize: 15,
						color: "#666666"
					},
					extra: {
						arcbar: {
							type: "circle",
							width: 12,
							backgroundColor: "#E9E9E9",
							startAngle: 1.5,
							endAngle: 0.25,
							gap: 2
						}
					}
				}
			};
		},
		onReady() {
			this.getServerData1();
			this.getServerData2();
		},
		methods: {
			getServerData2() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						series: [{
								name: "一班",
								data: 0.8
							},
							{
								name: "二班",
								data: 0.6
							},
							{
								name: "三班",
								data: 0.45
							},
							{
								name: "四班",
								data: 0.3
							},
							{
								name: "五班",
								data: 0.15
							}
						]
					};
					this.chartData2 = JSON.parse(JSON.stringify(res));
				}, 500);
			},
			getServerData1() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						series: [{
								name: "气泡一",
								data: [
									[95, 95, 20, "标题1"],
									[30, 55, 33, "标题2"]
								]
							},
							{
								name: "气泡二",
								data: [
									[130, 30, 30, "标题3"],
									[200, 90, 40, "标题4"]
								]
							}
						]
					};
					this.chartData1 = JSON.parse(JSON.stringify(res));
				}, 500);
			},
		}
	}
</script>
<style>
	page {
		background-color: white;
		height: 100%;
	}
</style>
<style lang="scss" scoped>
	.charts-box {
		width: 100%;
		height: 300px;
	}
</style>
